﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace FUSE
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public static class MapGenerator
    {


        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public static void Initialize()
        {
            // TODO: Add your initialization code here
            //backgroundTex = newBTex;

            //Create grid virtual representation of galaxy and components
            //map.x = newBTex.Bounds.Width;
            //ySize = newBTex.Bounds.Height;


            //galaxyComponentsTable = MapGenerator.createComponentsTable();

            //galaxyForces = PhysicsEngine.createGravityGrid(this);



        }


        public static Hashtable createComponentsTable()
        {
            Hashtable galaxyObjectsTable = new Hashtable();
            String key = "Jupiter";
            Planet planet = new Planet();

            //public void Initialize(int newMass, int newPoints, Texture2D newImage, Rectangle imageSource, Vector2 newPosition)
            planet.Initialize(5, 10, null, new Rectangle(3, 3, 10, 10), new Vector2(10, 10));
            planet.SlingCircle = new Circle(new Vector2(10, 10), 8f);
            planet.CrashCircle = new Circle(new Vector2(10, 10), 3f);
            
            GalaxyComponent value = planet;
            galaxyObjectsTable.Add(key,value );
            foreach (DictionaryEntry entry in galaxyObjectsTable)
            {
                if (entry.Value is GalaxyComponent || entry.Value is IMassedComponent || entry.Value is Planet)
                {
                    Console.WriteLine("IT IS RECOGINIZED MAP GENERATOR");
                }
                else
                {
                    Debug.Assert(false);
                }
            }

            return galaxyObjectsTable;

        }
    }
}
